<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.operations.process.cycleTime.forms.StageCycleTimeForm,
                 com.scalar.chiptrack.operations.process.cycleTime.StageDetails,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.commons.Constants"
                %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/stageCycleTime.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML>
    <HEAD>
        <TITLE>Scalarsoft - ChipTrac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>
        <script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
        <script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

        <script language="javascript">

            function loadPartNumbers()
            {
                var form = document.stageCycleTimeForm;

                form.action.value="partNumbers";
                form.submit();
            }
            function loadStageDetails()
            {
                var form = document.stageCycleTimeForm;

                form.action.value="stages";
                form.submit();
            }
            function save()
            {

                var form = document.stageCycleTimeForm;
                form.action.value="save";
                form.submit();
            }

            function reset()
            {
                document.stageCycleTimeForm.reset();
            }
        </script>
    </HEAD>
    <BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TR>
            <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
                <!-- Side Navigation start -->
                <%@ include file="/jsp/operations/product_menu.jsp" %>
                <!-- end of the side navigations -->
            </TD>
            <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
            <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
            <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
                <html:form action="/stageCycleTime" method="POST">
                <TABLE border="0" width="90%" align="center">
                        <input type="hidden" name="action" value="<%= (String)request.getAttribute("action")%>">
                        <TR><TD class="NArialW" colspan="5" align="center">Stage Cycle Time Setup</TD></TR>
                        <logic:equal name="showMessage" value="TRUE">
                            <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></td></tr>
                        </logic:equal>
                        <TR><TD colspan="5">&nbsp;</TD></TR>
                            <TR><TD colspan="5" class='NArialL'><B><FONT id="errors" styleClass="NArialL" color='FF0000'></FONT></b></TD></TR>
                        <TR>
                            <TD colspan="5">
                                <chiptrack:info styleClass="NArialL" />
                                <chiptrack:errors styleClass="NArialL" />
                                <chiptrack:messages type="info" styleClass="NArialL" />
                            </TD>
                        </TR>
                        <TR>
                            <TD colspan="5">
                                <TABLE border="0" width="100%" cellpadding="1" cellspacing="5">
                                    <TR>
                                        <TD width="15%" class="NArialL">Vendor Name:</TD>
                                        <TD width="20%" class="NArialL" align="left">
                                            <html:select property="locationId"  name="stageCycleTimeForm" styleClass="txfield" onchange="loadPartNumbers();">
                                                <html:option value="-1">-Select Vendor Name-</html:option>
                                                <html:options collection="locationsList" property="value" labelProperty="label"/>
                                            </html:select>
                                        </TD>
                                        <TD width="5%">&nbsp;</TD>
                                        <logic:notEqual property="locationId" name="stageCycleTimeForm" value="-1">
                                        <TD width="15%" class="NArialL">Part Number:</TD>
                                        <TD width="45%" class="NArialL" align="left">
                                            <html:select property="processstepId"  name="stageCycleTimeForm" styleClass="txfield" onchange="loadStageDetails();">
                                                <html:option value="-1">-Select Part Number-</html:option>
                                                <html:options collection="partNumberList" property="value" labelProperty="label"/>
                                            </html:select>
                                        </TD>
                                        </logic:notEqual>
                                        <logic:equal property="locationId" name="stageCycleTimeForm" value="-1">
                                            <TD colspan="2" width="60%">&nbsp;</TD>
                                        </logic:equal>
                                    </TR>
                                    <TR>
                                        <TD colspan="5" bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
                                    </TR>
                                    <logic:notEqual property="processstepId" name="stageCycleTimeForm" value="-1">
                                    <bean:size id="ALSize" name="stageCycleTimeForm" property="stageDetails" />
                                    <logic:greaterThan name="ALSize" value="0">
                                    <TR>
                                        <TD class="NArialL" colspan="5" width="100%" align="center">
                                            <TABLE width="50%" align="center" border="0">
                                                <TR>
                                                    <TD width="10%" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Stage Name</font></font></TD>
                                                    <TD width="10%" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;Cycle Time</font></font></TD>
                                                </TR>
                                                <nested:iterate name="stageCycleTimeForm" property="stageDetails" type="com.scalar.chiptrack.operations.process.cycleTime.StageDetails">
                                                <TR>
                                                    <TD bgcolor="#FFFFEE"><font class="NArialL">
                                                        <nested:write property="stageName" />
                                                        <nested:hidden property="stageId" ></nested:hidden>
                                                        </font>
                                                    </TD>
                                                    <TD  bgcolor="#FFFFEE">&nbsp;<font class="NArialL">
                                                        <nested:text property="cycleTime" onkeypress="allowInteger()" size="5" maxlength="5" styleClass="txfield" />
                                                        <input type="hidden" name="noOfStageIdsHidden">
                                                        </font>
                                                    </TD>
                                                </TR>
                                                </nested:iterate>
                                            </TABLE>
                                        </TD>
                                    </TR>
                                    </logic:greaterThan>
                                    </logic:notEqual>
                                    <TR>
                                        <TD colspan="5" bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
                                    </TR>
                                    <logic:notEqual property="processstepId" name="stageCycleTimeForm" value="-1">
                                    <bean:size id="ALSize1" name="stageCycleTimeForm" property="stageDetails" />
                                    <logic:greaterThan name="ALSize1" value="0">
                                    <TR>
                                        <TD colspan="5" align="center">
                                            <chiptrack:restrictedLink functionality='<%=Functionality.STAGE_CYCLE_TIME_SETUP %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:save();' onmouseover="window.status='Click to Save Stage Cycle Time Information ';return true" onmouseout="window.status='';return true">
                                                <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click here to Save Stage Cycle Time Information"/>
                                            </chiptrack:restrictedLink>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                                        </TD>
                                    </TR>
                                    </logic:greaterThan>
                                    </logic:notEqual>
                                </TABLE>
                            </html:form>
                            <BR><BR><BR></TD>
                            <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
                        </TR>
                    </TABLE>
                </TD>
            </TR>
        </table>
    <!-- Footer starts here -->
    <%@ include file="/jsp/includes/footer.jsp" %>
    <!-- footer end here -->
    </BODY>
</HTML>

